import java.util.Arrays;

class MyStack{
    public int[] elem;
    public int useSize;
    public MyStack(){
        this.elem=new int[10];
    }
    public void push(int val){
        if(ifFull()){
            elem= Arrays.copyOf(elem,elem.length*2);
        }
        elem[useSize]=val;
        useSize++;

    }
    public boolean ifFull(){
        return useSize==elem.length;
    }
    public int pop(){
        if(empty()){
            return -1;
        }
        int oidVal=elem[useSize-1];
        useSize--;
        return oidVal;

    }
    public boolean empty(){
        return useSize==0;
    }
    public int peek(){
        if(empty()){
            return -1;
        }
        return elem[useSize-1];
    }

}
public class Text2 {
    public static void main(String[] args) {
        MyStack myStack=new MyStack();
        myStack.push(12);
        myStack.pop();
    }

}
